import Vue from 'vue'
import App from './App.vue'
import router from './router';
import store from "@/store";
import request from './utils/request'
import VueCookie from "vue-cookie";
import {message} from "@/utils/restMessage";
// import vuescroll from 'vue-scroll'

import ElementUI from 'element-ui'
// import 'element-theme-chalk';
import 'element-ui/lib/theme-chalk/index.css';
import '/src/assets/scss/element-variables.scss'


Vue.use(VueCookie)
// Vue.use(vuescroll)

Vue.config.productionTip = false

Vue.prototype.request = request
Vue.prototype.$message = message

/*//vue懒加载
Vue.directive('lazy', {
    bind: function (el, binding) {
        let lazyLoadObser = new IntersectionObserver((entries, observer) => {
            console.log(observer)
            entries.forEach((entry, index) => {
                console.log(index)
                let lazyImage = entry.target
                if (entry.intersectionRatio > 0) {
                    binding.value.throttle(binding.value.getData,200)(binding.value.id, lazyLoadObser, lazyImage)
                }
            })
        })
        lazyLoadObser.observe(el)
    }
})*/


Vue.use(ElementUI, { size: "" });

new Vue({
    router,
    store,
    render: h => h(App),
    created() {
        store.dispatch('permission/GenerateRoutes')
    }
}).$mount('#app')
